{include file="/wap/public/top" /}   
{include file="/public/layui" /}
<link rel="stylesheet" type="text/css" href="__indexwap__/css/reg.css">
<style>
 .ico_name,.form_group .inp,.ico_exa,.ico_mobile,.ico_exa,.ico_pwd {
     height: 38px;
 }

</style>
<div class="header" style="    background: #eee;"> 
 
</div>
 <form class="loginForm" id="theForm" action="" method="post"  style="display: ;">
<div class="formBox reg_slides">
	<div class="wrap clearfix registerWrap">
    	<div class="sreg_box">
        	<div class="hd clearfix"><div class="tit">注&nbsp;册</div> <div class="r">已有帐号，<a href="{:url('index/login')}">马上登录</a></div></div>
            <div class="form_inline">
            	<div class="error_tip none"><p id="error_detail_message"><!-- 请输入正确的用户名和密码 --></p></div>
            	  <div class="form_group clearfix">
                    <label for="username"><i class="ico_name"></i></label>
					
                   
                    <input type="text" class="inp" name="username" id="username" onkeyup="value=value.replace(/[^\w\.\/]/ig,'')" size="28" placeholder="用户名（4-20位字母或数字）">
					
					
                    <div class="error"></div>
                    <div class="errorTip" id="tip_name" style="display: none;">
                        <i class="ico_tip" id="ico_tip_verfiycode"></i><span id="usernameTip"><!-- 用户名输入格式错误 --></span>
                    </div>
					
					
                  </div>
                  <!-- 图片验证码开始 -->
                   <div class="clearfix">
                    <div class="form_group form_exa">
                        <label for="exa"><i class="ico_exa"></i></label>
                        <input type="text" class="inp" name="" id="vertifyf" size="6" maxlength="4" placeholder="验证码">
                        <div class="error"></div>
                        <div class="errorTip" id="tip_codeImg" style="display: none;">
                            <i class="ico_tip"></i><span id="codeTip">验证码输入格式错误</span>
                        </div>
                    </div>
                    <div class="l"><div class="yzm"><img id='imgVerify' src="{:captcha_src()}" onclick="this.src='{:captcha_src()}'"></div></div>
                  </div>
                  <!-- 图片验证码结束 -->
                  <div class="form_group clearfix">
                    <label for="phone"><i class="ico_mobile"></i></label>
                    <input type="text" class="inp" id="mobile" name="mobile" size="28" placeholder="请勿使用已注册手机号">
                    <div class="error"></div>
                    <div class="errorTip" id="tip_phone" style="display: none;">
                        <i class="ico_tip"></i><span id="phoneTip"></span>
                    </div>
                  </div>
                  <div class="clearfix">
                    <div class="form_group form_exa">
                        <label for="exa"><i class="ico_exa"></i></label>
                        <input type="text" class="inp iphoneCode" name="vertify"id="exa" size="6" maxlength="6" placeholder="短信验证码">
                        <input type="text" name="username" style="display:none;">
                        <div class="errorTip" id="tip_code" style="display: none;">
							<i class="ico_tip"></i><span id="codeTip"><!-- 用户名输入格式错误 --></span>

						</div>
						<div class="errorTip" id="send_call_verify" style="display: none;"></div>

                    </div>
					<!--
                    <div class="l"> <span type="button"  class="btn_block stext" id="getRegisterCode">获取验证码</span></div>-->
                    <div class="l"> 
                    <span id="jq_send" class="btn_block stext" style="    width: 120px;">获取验证码</span>
                    </div> 
                  </div> 
                  <div class="form_group clearfix">
                  	<div class="pwd_tip" id="pwd_tip"><em></em></div>
                    <label for="pwd"><i class="ico_pwd"></i></label>
                   
                    <input type="password"  name="password"class="inp" id="pwd" size="28" placeholder="密码">
                    
                    <div class="error"></div>
                    <div class="errorTip" id="tip_pwd" style="display: none;">
                        <i class="ico_tip"></i><span id="pwdTip">密码输入格式错误</span>
                    </div>
                  </div>
                  <div class="form_group clearfix">
                    <label for="pwd"><i class="ico_pwd"></i></label>
                    <input type="password" class="inp" name="password2" id="pwd_again" size="28" placeholder="确认密码">
                    <div class="error"></div>
                    <div class="errorTip" id="tip_pwd_again" style="display: none;">
                        <i class="ico_tip"></i><span id="pwd_againTip">2次密码不一致</span>
                    </div>
                  </div>
             <!--      <div class="form_group clearfix">
                    <label for="email"><i class="ico_email"></i></label>
                    <input type="text" class="inp" id="email" placeholder="邮箱">
                    <div class="error"></div>
                    <div class="errorTip" id="tip_email">
                        <i class="ico_tip"></i><span id="email_Tip">邮箱输入格式错误</span>
                  </div>
                  </div> -->
                   <div class="form_group clearfix">
                    <label for="qq"><i class="ico_qq"></i></label>
                    <input type="text" class="inp" id="qq" size="28" placeholder="微信或者QQ(选填)">
                    <div class="error"></div>
                    <div class="errorTip" id="tip_qq" style="display: none;">
                        <i class="ico_tip"></i><span id="qqTip">微信或者QQ输入格式错误</span>
                    </div>
                  </div>
                   <div class="form_group clearfix">
                    <label for="yaoqingren"><i class="ico_yaoqingren"></i></label>
                    <input type="text" value="{$id}" {if condition="$id neq ''"}readonly='readonly'{/if} class="inp" name="inviter" id="yaoqingren" size="12" placeholder="填入邀请人推荐人ID">
                  </div>
                  <div class="form_checkbox clearfix">
                  	<input id="tiaokuan" name="" type="checkbox" value="" checked=""> 我同意<a href="{:url('index/zcxy')}" target="_blank"><span>《投资注册协议》</span></a>
					<div class="errorTip" id="tip_tiaokuan" style="display: none;">
                        <i class="ico_tip"></i><span id="tiaokuanTip">您还没同意管理服务协议</span>
                    </div>
                  </div>
                  <input type="hidden" id="source" name="source" value="web">
                  <div class="form_btn_box clearfix">
                    <input type="button" id="mo" value="立即注册" class="btn_block">
                  </div>
                  <p class="tr"><a href="{:url('index/zhpwd')}">忘记密码</a></p>
            </div>
        </div>
    </div>	
</div>
 </form>

 <script type="text/javascript">
        var mobile_timeout;
        var mobile_count = 100;
        var mobile_lock = 0;
        $(function () {
            $("#jq_send").click(function () {
				if(!onblurv()){return false;}
                if (mobile_lock == 0) {
                    mobile_lock = 1;
                    $.post("/index.php/index/sendsms/sendsms",{mobile:$("#mobile").val()},function(data){console.log(data);
                        if(data.status == 'success'){
							
                            mobile_count = 60;
                           msg("发送成功");
                           $('.iphoneCode').val(data.num);
                            BtnCount();

                        }else{
							msg("发送失败");
                            mobile_lock = 0;
                           
                        }
                    },'json');

					return false;
                }

            });

			
        });
		function onblurv(){
		 
		 
			  var ver=$("#vertifyf").val();
			  var retu=false;
			   $.ajax({
                        async:false,
                        url:"{:url('index/regvertifyf')}",
                        data:{'ver':ver},
                        type:'post',
                        dataType:'json',
                        success:function(res){
							
                            if(res.status != 1){
                                
								msg(res.msg);
                               
                            }else{
								
                               $("#jq_send").attr('disabled',false); retu=true;
                            }
                        },
                        error : function(XMLHttpRequest, textStatus, errorThrown) {
							
                            msg('网络失败，请刷新页面后重试!');
                            //$('#error').html('<span class="error">网络失败，请刷新页面后重试!</span>');
                        }
                    });
			
		  return retu;
		};
		
        function BtnCount () {
            if (mobile_count == 0) {
                $('#jq_send').html("重新发送"); $("#jq_send").attr('disabled',false);
                mobile_lock = 0;
                clearTimeout(mobile_timeout);
            }
            else {
                mobile_count--;
				 $("#jq_send").attr('disabled',true);
                $('#jq_send').html("重新发送(" + mobile_count.toString() + ")秒");
                mobile_timeout = setTimeout(BtnCount, 1000);
            }
        };
    </script> 


<script>
$(function(){
 function loginsubmit(){
	
                var username=true;
                var password=true;
				var passwordf=true;
				var mobile=true;
                var vertify=true;
                
                if($('#theForm input[name=username]').val() == ''){
                    //$('#error').html('<span class="error">用户名不能为空!</span>');
					msg('用户名不能为空!');
 
                    $('#theForm input[name=name]').focus();
                    username = false;
                    return false;
                }


                if($('#theForm input[name=password]').val() == ''){
					msg('密码不能为空!');
                   
                    $('#theForm input[name=password]').focus();
                    password = false;
                    return false;
                }
				if($('#theForm input[name=password2]').val() == ''){
                      msg('确认密码不能为空!');
                 
                    $('#theForm input[name=password2]').focus();
                    passwordf = false;
                    return false;
                }
				if($('#theForm input[name=password2]').val() != $('#theForm input[name=password]').val()){
                   
					msg("二次密码不一致");
                    $('#theForm input[name=password2]').focus();
					 $('#theForm input[name=password]').focus();
                    password = false; passwordf = false;
                    return false;
                }
				if($('#theForm input[name=mobile]').val() == ''){
                   // $('#error').html('<span class="error">手机号不能为空!</span>');
					msg('手机号不能为空!');
                    $('#theForm input[name=mobile]').focus();
                    mobile = false;
                    return false;
                }

                if($('#theForm input[name=vertify]').val() == ''){
                    //$('#error').html('<span class="error">验证码不能为空!</span>');
					msg('验证码不能为空!');

                    $('#theForm input[name=vertify]').focus();
                    vertify = false;
                    return false;
                }
				if(!$("#tiaokuan").is(':checked')){
				msg('请同意，投资注册协议！');return false;
				}
//'pwd':$('#theForm input[name=password]').val()
                if(vertify && $('#theForm input[name=username]').val() != '' && $('#theForm input[name=password]').val() != ''){
                    $.ajax({
                        async:false,
                        url:"{:url('index/reg')}",
                        data:{'name':$('#theForm input[name=username]').val(),'inviter':$('#theForm input[name=inviter]').val(),'pwd':$('#theForm input[name=password]').val(),'qq':$('#qq').val(),'mobile':$('#theForm input[name=mobile]').val(),'vertify':$('#theForm input[name=vertify]').val()},
                        type:'post',
                        dataType:'json',
                        success:function(res){
								console.log(res);
                            if(res.status != 1){
                                //$('#error').html('<span class="error">'+res.msg+'!</span>');
								msg(res.msg);
                                
                                username=false;
                                password=false;
                                return false;
                            }else{
								fleshVerify();
								alert("注册成功");
                                top.location.href = res.url;
                            }
                        },
                        error : function(XMLHttpRequest, textStatus, errorThrown) {
							
                            msg('网络失败，请刷新页面后重试!');
                            //$('#error').html('<span class="error">网络失败，请刷新页面后重试!</span>');
                        }
                    });
                }else{
                    return false;
                }
            }

           
            $('#mo').on('click',function(){
				
                loginsubmit();
            });
			
			
			
           
			function fleshVerify(){
            $('#imgVerify').attr('src','{:captcha_src()}');//重载验证码
        }
        });
</script>
  {include file="/wap/public/hder" /}